<template>
  <el-dialog title="提现审核" :close-on-click-modal="false" :visible.sync="visible" width="50%">
    <template>
      <el-row>
        <el-col style="width: 80px">
          <span>审核操作：</span>
        </el-col>
        <el-col :span="20">
          <el-radio-group v-model="isCheck">
            <el-radio label="1">驳回</el-radio>
            <el-radio label="2">通过</el-radio>
          </el-radio-group>
        </el-col>
      </el-row>
      <el-row style="margin-left: 80px;margin-top: 20px" v-show="isCheck!=2">
        <el-col :span="16">
          <el-input type="textarea"
                    v-model="refuseExt"
                    :autosize="{ minRows: 2, maxRows: 4}"
                    placeholder="请输入不通过理由"></el-input>
        </el-col>
      </el-row>
      <el-row class="submitBtn">
        <el-button :loading="loading" size="mini" type="primary" @click="submitClick">提 交</el-button>
      </el-row>
    </template>
  </el-dialog>
</template>

<script>
  export default {
    name: 'auditWithdraw',
    data () {
      return {
        id: '',
        visible: false,
        isCheck: '2',
        refuseExt: '',
        loading: false
      }
    },
    methods: {
      init (id) {
        this.visible = true
        this.id = id
      },
      submitClick () {
        this.loading = true
        this.$http({
          url: this.$http.adornUrl('/cash/out/examine'),
          method: 'post',
          data: this.$http.adornData({
            id: this.id,
            remark: this.refuseExt,
            status: this.isCheck
          })
        }).then(({ data }) => {
          this.loading = false
          this.$message({
            message: '保存成功',
            type: 'success',
            duration: 1500,
            onClose: () => {
              this.$emit('refreshDataList')
            }
          })
        }).catch(() => {
          this.loading = false
        })
      }
    }
  }
</script>

<style scoped>
  .submitBtn{
    padding-left: 80px;
    padding-top: 30px;
  }
</style>
